/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI;

import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Font;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 *
 * @author Jaime
 */
public final class SquarePanel extends JPanel{
    
    private int squareType;
    private JLabel label;
    
    public SquarePanel(int squareType)
    {
        label = new JLabel();
        label.setFont(new Font("Sans Serif", Font.BOLD, 20));
        setBorder(BorderFactory.createLineBorder(Color.black));
        setLayout(new FlowLayout());
        add(label);
        setType(squareType);  
        setBackground(Color.white);
    }

    /**
     * Set the panel type:
     * 0: empty panel
     * 1: start panel
     * 2: cliff panel
     * 3: goal panel
     * 4: current position panel
     * 5: trajectory panel
     * @param squareType 
     */
    public void setType(int squareType) {
        this.squareType = squareType;

        switch(squareType)
        {
            case 0: 
                label.setText("");
                break;
            case 1:
                label.setText("S");
                label.setForeground(Color.CYAN);
                break;
            case 2:
                label.setText("C");
                label.setForeground(Color.red);
                break;
            case 3:
                label.setText("G");
                label.setForeground(Color.blue);
                break;
            case 4:
                label.setText("X");
                label.setForeground(Color.black);
                break;
            case 5:
                label.setText("0");
                label.setForeground(Color.black);
        }
        
        
        
        //label.repaint();
        //repaint();
        //revalidate();
        
    }
    
}
